<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                template="./../template/MemberTemplate.xhtml">

    <ui:define name="contentInsert">
               
        <h3>Your Items</h3>
        Here customers can view the items and vouchers they have purchased, as well as the group deals they are <br/>
        subscribed to.
        <br/>
        <br/>
        <!--*************************************Tab***********************************-->
        <p:tabView>
            
                <p:tab title="Item Purchases">  
                    <h:form>
                        <br/>
                    <p:dataTable value="#{cartBean.customerGetPurchases()}" var="o" paginator="true" rows="25" emptyMessage="Nothing to display.">


                        <p:column>
                            <f:facet name="header">Purchase Date</f:facet>
                            #{o.time_stamp.time}
                        </p:column>

                        <p:column>
                            <f:facet name="header">Outlet</f:facet>
                            #{o.outlet_name}
                        </p:column>

                        <p:column>
                            <f:facet name="header">Item Name</f:facet>
                            #{o.item_name}
                        </p:column>

                        <p:column>
                            <f:facet name="header">Quantity</f:facet>
                            #{o.quantity}
                        </p:column>

                        <p:column>
                            <f:facet name="header">Subtotal</f:facet>                         
                            <h:outputText value="#{o.subtotal}">
                                <f:convertNumber type="currency" currencySymbol ="$"/>
                            </h:outputText>
                        </p:column>  
                        
                           
                    </p:dataTable>
                    </h:form>    
                </p:tab>
            
                <!--******************************************************************-->
                
                <p:tab title="Subscribed Group Deals">  
                    <h:form>
                        <p:dataTable value="#{groupBuyCustManagedBean.customerGetGroupDeals()}" var="o" paginator="true" rows="25" emptyMessage="Nothing to display." style="font-size: 10px">
                            <p:column>
                                <f:facet name="header">Purchase Date</f:facet>
                            #{o.time_stamp.time}
                            </p:column>
                            
                            <p:column>
                                <f:facet name="header">Seller</f:facet>
                                #{o.seller}
                            </p:column>
                            
                            <p:column>
                                <f:facet name="header">Deal</f:facet>
                                #{o.item_name}
                            </p:column>
                            
                            <p:column style="width:40%">
                                <f:facet name="header">Description</f:facet>
                                <h:outputText value="#{o.item_description}" escape="false"/>
                               
                            </p:column>
                            
                            <p:column style="width:8%">
                                <f:facet name="header">Coupons <br/> Purchased</f:facet>
                                #{o.quantity}
                            </p:column>
                            
                            <p:column style="width:8%">
                                <f:facet name="header">Coupons <br/> Redeemed</f:facet>
                                #{o.noRedeemed}
                            </p:column>
                            
                            <p:column>
                                <f:facet name="header">Subtotal</f:facet>
                                <h:outputText value="#{o.subtotal}">
                                    <f:convertNumber type="currency" currencySymbol ="$"/>
                                </h:outputText>
                            </p:column>
                            
                            
                        </p:dataTable>
                    </h:form>
                </p:tab>
            
                <!--******************************************************************-->

                <p:tab title="Vouchers">  
                    <h:form>          
                        <br/>
                        <p:dataTable value="#{rewardMB.getVouchersByCustomer()}" var="o"
                                     paginator="true" rows="20"
                                     emptyMessage="Nothing to display."
                                     >


                            <p:column style="width: 10%">
                                <f:facet name="header">ID</f:facet>
                                                        #{o.id}
                            </p:column>


                            <p:column style="width: 15%">
                                <f:facet name="header">Name</f:facet>
                                                        #{o.reward_Name}
                            </p:column>

                            <p:column style="width: 30%">
                                <f:facet name="header">Description</f:facet>
                                <h:outputText value="#{o.reward_Description}" escape="false"/>

                            </p:column>

                            <p:column style="width: 10%">
                                <f:facet name="header">Points <br/> Cost</f:facet>
                                #{o.reward_Cost}                                       
                            </p:column>

                            <p:column style="width: 5%">
                                <f:facet name="header">Purchase <br/> Date</f:facet>
                                                        #{o.purchaseDate}
                            </p:column>

                            <p:column style="width: 5%">
                                <f:facet name="header">Redemption <br/> Date</f:facet>
                                                        #{o.redemptionDate}
                            </p:column>

                        </p:dataTable>
                    </h:form>
                </p:tab>
            
         
        </p:tabView>
        <!--*************************************End Tab***********************************-->   

    </ui:define>
</ui:composition>

